package com.unidt.www.module.third.workbar.app;

import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.client.RestTemplate;

import java.util.Map;

/**
 * @Author sk
 * @Description:
 * @Date 2022/11/17 14:48
 **/
public class RequestUtils {

    public static RestTemplate  getRestTemplate(){

        return  new RestTemplate();
    }

    public static HttpHeaders getBaseHeader(){

        HttpHeaders headers = new HttpHeaders();
        MediaType mediaType = MediaType.parseMediaType("application/json;charset=UTF-8");
        headers.setContentType(mediaType);

        return  headers;
    }


    public static HttpHeaders getBaseHeader(Map<String,String> header){

        HttpHeaders headers = new HttpHeaders();
        MediaType mediaType = MediaType.parseMediaType("application/json;charset=UTF-8");
        headers.setContentType(mediaType);

        return  headers;
    }


    public static HttpHeaders getBaseHeader(String key,String value){
        HttpHeaders headers = new HttpHeaders();
        MediaType mediaType = MediaType.parseMediaType("application/json;charset=UTF-8");
        headers.setContentType(mediaType);
        headers.add(key,value);
        return  headers;
    }




}
